//
//  CTPPlacesFetcher.m
//  citipad
//
//  Created by Chih Yuan Liu on 3/14/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "CTPPlacesFetcher.h"


@implementation CTPPlacesFetcher

@synthesize delegate;

- (void)requestSucceeded {
	[delegate placesFetcherSucceeded: self data:recievedData];
	[delegate placesFetcherEnd:self];
}

-(void)requestFailed:(NSError*)error {
	[delegate placesFetcherFailed:self];
	[delegate placesFetcherEnd:self];
}

-(NSString*) URLForCtpProxy:(double)lat lng:(double)lng{
	NSString* url = [NSString stringWithFormat:
					 @"http://114.34.48.246/CtpSvr/svr.ashx?method=places&key=%f,%f", 
					 lat, lng];
	return url;
}

-(void)getDataFromCtp:(double)lat lng:(double)lng{
	NSString* url = [self URLForCtpProxy:lat lng:lng];
	NSLog(@"%@", url);
	[super requestGET:url];
	[delegate placesFetcherBegin:self];
}


@end
